package com.macro.mall.bean.entity;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * odr_order_reason实体类
 *
 * @author gaodx
 *
 */
@Data
@Builder
@AllArgsConstructor
public class OdrOrderReason implements Serializable{
	/**id*/
    @ApiModelProperty(value = "id")
	private Integer id; 
	/**订单id*/
    @ApiModelProperty(value = "订单id")
	private Integer orderId; 
	/**原因*/
    @ApiModelProperty(value = "原因")
	private String cancelReason; 
	/**补充说明*/
    @ApiModelProperty(value = "补充说明")
	private String explain; 
	/**创建时间*/
    @ApiModelProperty(value = "创建时间")
	private Date createTime; 
	/**
	 * 实例化
	 */
	public OdrOrderReason() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public OdrOrderReason(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).intValue());
		}
		if (obj.get("orderId") instanceof Number) {
			this.setOrderId(((Number) obj.get("orderId")).intValue());
		}
		if (obj.get("cancelReason") instanceof String) {
			this.setCancelReason((String) obj.get("cancelReason"));
		}
		if (obj.get("explain") instanceof String) {
			this.setExplain((String) obj.get("explain"));
		}
		this.setCreateTime((Date) obj.get("createTime"));
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getOrderId() != null) {
			result.put("orderId",this.getOrderId());
		}
		if (this.getCancelReason() != null) {
			result.put("cancelReason",this.getCancelReason());
		}
		if (this.getExplain() != null) {
			result.put("explain",this.getExplain());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		return result;
	}


	@Override
	public String toString() {
		return "OdrOrderReason [id=" + id + " , orderId=" + orderId + " , cancelReason=" + cancelReason + " , explain=" + explain + " , createTime=" + createTime + "  ]";
	
	}
	
	
}
